Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xstream

Package Overview
Dependencies
Maintainers
2
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xstream

An extremely intuitive, small, and fast functional reactive stream library for JavaScript

  • 11.14.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
138K
increased by1.9%
Maintainers
2
Weekly downloads
 
Created

What is xstream?

xstream is a small, fast, and modular library for reactive programming using streams. It allows you to create, transform, and combine streams of events in a functional and declarative manner.

What are xstream's main functionalities?

Creating Streams

This feature allows you to create a stream from a sequence of values. The `xs.of` method creates a stream that emits the values 1, 2, and 3, and then completes.

const xs = require('xstream');
const stream = xs.of(1, 2, 3);
stream.addListener({
  next: i => console.log(i),
  error: err => console.error(err),
  complete: () => console.log('completed')
});

Transforming Streams

This feature allows you to transform the values emitted by a stream. The `map` method is used to multiply each value by 2.

const xs = require('xstream');
const stream = xs.of(1, 2, 3).map(x => x * 2);
stream.addListener({
  next: i => console.log(i),
  error: err => console.error(err),
  complete: () => console.log('completed')
});

Combining Streams

This feature allows you to combine multiple streams into one. The `combine` method merges the streams and emits an array of the latest values from each stream.

const xs = require('xstream');
const stream1 = xs.of(1, 2, 3);
const stream2 = xs.of('a', 'b', 'c');
const combined = xs.combine(stream1, stream2);
combined.addListener({
  next: ([i, j]) => console.log(i, j),
  error: err => console.error(err),
  complete: () => console.log('completed')
});

Other packages similar to xstream

FAQs

Package last updated on 12 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc